package com.palpiteiro.dao;

import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

import com.palpiteiro.bean.*;

public class LogDAO extends IDAO {

	@Override
	public ResultSet select(IBean bean) throws SQLException {
		// TODO Futura tela de log?
		return null;
	}

	@Override
	public void insert(IBean bean) throws SQLException {

		Log log = (Log) bean;
		String sql = "";
		
		sql = "insert into \"Admin\".\"Log\" " +
			  "(tipo_log, descricao, id_login) " +
			  "values (?,?,?)";
		
		PreparedStatement stmt = getConn().prepareStatement(sql);
		
		stmt.setInt(1, log.getTipo_log().getId());
		stmt.setString(2, log.getDescricao());
		stmt.setString(3, log.getLogin());
		
		stmt.executeUpdate();
		
	}

	@Override
	public void update(IBean bean) throws SQLException { /*Log can't be updated.*/ }

}
